<?php

namespace App\Validate;

class AmountValidation extends BaseValidation
{
    //  check 方法的参数
    // * @param array   $data 数据
    // * @param string  $scene 验证场景
    // * @param mixed   $rules 验证规则
    // * @param array  $message 自定义验证信息

    // 调用案例 

    // make(AmountValidation::class)->check($this->request->all(),__FUNCTION__)

    //返回响应值的  ->response()

    //返回boole   ->get()

    //返回报错信息  ->getError()

    //验证规则
    protected $rule = [
        'id' => 'required',
        'name' => 'required',
        'ori_amount' => 'required|numeric',
        'discount' => 'required|numeric|between:0,10',
        'type_id' => 'required|numeric',
        'amount' => 'required|numeric',
        'ori_amount'=> 'required|numeric',
        'item_id'=>  'required|numeric',
    ];
    //自定义验证信息
    protected $message = [
        'item_id.required'=>'商品编码 必须'
    ];

    //自定义场景
    protected $scene = [
        'oilAdd' => ['ori_amount', 'discount', 'type_id','name','item_id'],
        'oilEdit' => ['id', 'ori_amount', 'discount', 'type_id','name','item_id'],
        'oilDel' => ['id'],
        'oilChannel' => ['id'],
        'typeAdd' => ['name'],
        'typeEdit' => ['id', 'name'],
        'typeDel' => ['id'],
        'amountAdd' => ['ori_amount', 'amount', 'type_id'],
        'amountEdit' => ['id', 'ori_amount', 'amount', 'type_id'],
        'amountDel'=> ['id'],
        'channelEdit'=> ['id'],
        'rpcLegalDisCountAmount'=> ['type_id','amount','ori_amount'],
    ];
}
